package com.hanggold.undertow;

import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;

/**
 * @author <a href="mailto:sunmch@163.com">smc</a>
 * @date 2021-06-12 11:54
 * @since 1.0.0
 **/
public class UndertowServerApplication {
    
    public static void main(String[] args) {
        Undertow undertow = Undertow.builder().addHttpListener(8888, "127.0.0.1")
            .setHandler(new HttpHandler() {
                @Override
                public void handleRequest(final HttpServerExchange exchange) throws Exception {
                    exchange.getResponseSender().send("helloworld");
                }
            }).build();
        
        undertow.start();
    
        System.out.println("undertow start success");
    
    }
}
